package com.winning.pmph.entity;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;

import javax.persistence.Table;
import javax.persistence.Transient;
import javax.xml.bind.annotation.*;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

@Data
@Table(name = "exam_book")
@XmlRootElement(name = "book")
@XmlAccessorType(XmlAccessType.FIELD)
public class ExamBook extends BaseEntity {
    public static final Integer IMPORT_SUCCESS_STATUS = 1;
    public static final Integer IMPORT_FAILURE_STATUS = 2;
    public static final Integer IMPORT_STATUS = 0;
    private static final long serialVersionUID = 1L;
    /**
     * ID
     */
    @TableId
    private String id;
    private String examOutlineId;

    /**
     * 图书名称
     */
    @XmlTransient
    private String name;

    /**
     * 书号
     */
    @XmlTransient
    private String isbn;

    /**
     * 元数据
     */
    private JSONObject metadata;
    /**
     * 适应专业
     */
    private String adaptMajors;
    /**
     * 专业代码
     */
    private String majorsCode;
    private Integer num;
    private String failureReason;
    private int status;

    @XmlElementWrapper(name = "front_of_book")
    @XmlElement(name = "Article")
    @Transient
    @TableField(exist = false)
    private List<ExamBookArticle> frontArticleList;

    @XmlElementWrapper(name = "body_of_book")
    @XmlElement(name = "Article")
    @Transient
    @TableField(exist = false)
    private List<ExamBookArticle> bodyArticleList;

    @XmlElementWrapper(name = "back_of_book")
    @XmlElement(name = "Article")
    @Transient
    @TableField(exist = false)
    private List<ExamBookArticle> backArticleList;

    @TableField(exist = false)
    private List<ExamBookPic> bookPicList = new ArrayList<>();
    @TableField(exist = false)
    private List<ExamBookTable> bookTableList = new ArrayList<>();
    @TableField(exist = false)
    private Set<String> pictureSet = new HashSet<>();
    @TableField(exist = false)
    private int startNum;
    @TableField(exist = false)
    private int endNum;
    @TableField(exist = false)
    private String path;
    @TableField(exist = false)
    private String analysisPath;
    @TableField(exist = false)
    private String importTime;



}
